function submission() {
    var reservationsId =$("#reservationsId").val();
    var refereeId = $("input[name='about']:checked").val();
    if( refereeId==null || refereeId =='' ){
        alert('请选择推荐人！');
        str = [];
        return;
    }
    if ($("#avatar0PreId").children().length <= 0) {
        Feng.error("请上传图片！");
        return;
    }
    $.ajax({
        url: Feng.ctxPath +"/orthodonticsDetail/addorthodonticsReferee",
        type: "post",
        traditional: true,
        data: {
            "reservationsId":reservationsId,
            "refereeId": refereeId
        },
        success: function (data) {
            Feng.success('操作成功!');
            window.parent.orthodonticsDetail.table.refresh();
            $("#cancel").click();
        },
        error: function (data) {
            alert('没有权限，请联系系统管理员!');
            $("#cancel").click();
        }
    });
}

$("#search").click(function () { //查询转积分患者
    $.ajax({
        url: Feng.ctxPath + "/orthodonticsDetail/getRefereeOrthodontics",
        type: "post",
        data: {
            "name":$("#name").val()
        },
        success: function (data) {
            var listr ="";
            for(var i=0;i<data.length;i++){ //把数据渲染到archiving_content容器里面
                listr += '<div style="width: 25%;flex: none;"><span class="checkboxStyle">' +
                    '<input class="checkboxClass" type="radio" value="'+data[i].reservationsId+'" name="about" ' +
                    'id="click_'+data[i].account+'"></span>' +
                    '<label for="click_'+data[i].account+'"  class="labelStyle"">'+data[i].account+'</label></div>';
            }
            document.getElementById('customerName').innerHTML = listr;  // 初始化科室下拉框
        },
        error: function (data) {
            alert('没有权限，请联系系统管理员!');
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }
    });
});
var avatarUp0 = "",avatarUp1 = "";

$(function () {
    avatarUp0 = new $IconUpload("avatar0");
    avatarUp0.initIcon();
    avatarUp1 = new $IconUpload("avatar1");
    avatarUp1.initIcon();
});

$(document).on('click', '.cp_img_delete', function () {
    var that = this;
    var id = $(that).parent().attr("id");
    $.ajax({
        url: Feng.ctxPath + "/orthodonticsDetail/deleteImgOrthodontics",
        type: "post",
        data: {"id": id},
        success: function (data) {
            $(that).parent().remove();
            Feng.success("删除成功！");
        },
        error: function (data) {
            alert("删除失败！");
        }
    });
});


$("#customerName").on('click', '.checkboxStyle', function () {
    $(".checkboxStyle").removeClass('selection');
    $(this).addClass('selection');
});